﻿@model IEnumerable<School.ViewModels.GroupOrganization.CommentVM>
@using School.Common.JsonModels;
@{
    var user = User.Claims.FirstOrDefault();
    var pageGroup = ViewBag.PageGroup as School.Common.ViewModelComponents.PagenateGroup;
    var pageParameter = ViewBag.PageParameter as School.Common.JsonModels.ListPageParameter;
}
<style>
    .pagingt-process {
        display: none;
    }

    .per-comment {
        width: 94%;
    }
</style>
<link href="~/css/Common/pageingProcess.css" rel="stylesheet" />
<div>
    <input type="hidden" name="Id" id="Id" value="@ViewBag.activityId" />
    <!--输入评论-->
    <div class="per-comment  com-special-sign comment-sign" style="display:none" data_Id="@ViewBag.activityId">
    </div>
    <div class="clearfix comments  com-special-sign">
        <ul>
            @{
                foreach (var comment in Model)
                {
                    <li style="width: 100%;">
                        <div class="clearfix ar-com">
                            <div class="clearfix sc-left com-in">
                                <a href="#" class="sc-left com-image">
                                    <img src="@comment.User.Avatar.UploadPath" alt="">
                                </a>
                                <div class="com-per">
                                    <div class="clearfix">
                                        <a href="#" class="sc-left">@comment.User.Name :</a>
                                        <span class="">@comment.Comment</span>
                                    </div>
                                    <div class="com-reoly-sign">
                                        <time class="create-time">@comment.CommentDataTime</time>
                                        @{
                                            if (user != null)
                                            {
                                                <a href="#" class="ar-reply" title="回复" data_userName="@comment.User.Name" data_acId="@comment.ID"><i class="fa fa-comments-o"></i></a>
                                                if (user.Value == comment.User.Id)
                                                {
                                                    <a href="#" class="delete-reply" title="删除" data_acId="@comment.ID"><i class="fa fa-trash"></i></a>
                                                }
                                            }
                                        }
                                        <div class="reply-com">

                                        </div>
                                    </div>
                                    <!--子评论区开始-->
                                    <div class="clearfix comments">
                                        <ul>
                                            @{
                                                if (comment.CommentChildrens.Count != 0)
                                                {
                                                    foreach (var commentChildrens in comment.CommentChildrens)
                                                    {
                                                        <li style="width: 100%;">
                                                            <div class="clearfix ar-com">
                                                                <div class="clearfix sc-left com-in">
                                                                    <a href="#" class="sc-left com-image">
                                                                        <img src="@commentChildrens.User.Avatar.UploadPath" alt="">
                                                                    </a>
                                                                    <div class="com-per">
                                                                        <div class="clearfix">
                                                                            <a href="#" class="sc-left">@commentChildrens.User.Name</a><span style="width: 30px;font-size:14px">回复</span><a href="#">@(commentChildrens.AcceptUser == null ? "" : commentChildrens.AcceptUser.Name)</a>:
                                                                            <span class="">@commentChildrens.Comment</span>
                                                                        </div>
                                                                        <div class="com-reoly-sign">
                                                                            <time class="create-time">@commentChildrens.CommentDataTime</time>
                                                                            @{
                                                                                if (user != null)
                                                                                {
                                                                                    <a href="#" class="ar-reply" title="回复" data_userName="@comment.User.Name" data_acId="@comment.ID" data_acceptUserId="@comment.User.Id"><i class="fa fa-comments-o"></i></a>
                                                                                    if (user.Value == commentChildrens.User.Id)
                                                                                    {
                                                                                        <a href="#" class="delete-reply" title="删除" data_acId="@commentChildrens.ID"><i class="fa fa-trash"></i></a>
                                                                                    }
                                                                                }
                                                                            }
                                                                            <div class="reply-com">

                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </li>
                                                    }
                                                }

                                            }
                                        </ul>
                                    </div>
                                    <!--子评论区结束-->
                                </div>
                            </div>
                        </div>
                    </li>
                }
            }
        </ul>
    </div>

    <div>
        <div id="pagingt-process">
            @if (pageGroup.PagenateGroupItem == null)
            {
                <div class="center-block"> 根据当前查询的条件，没有任何结果。</div>
            }
            else
            {
                <nav aria-label="...">
                    <ul class="pagingt-ul clearfix">
                        @if (pageGroup.PagenateGroupItem.FirstIndex == 1)
                        {
                            <li class="disabled"><a pageGtoup="1" class="page-index-comment" aria-label="第一页"><span aria-hidden="true" class="fa fa-fast-backward"></span></a></li>
                            <li class="disabled"><a href="#" aria-label="回退一组"><span aria-hidden="true" class="fa fa-backward"></span></a></li>
                            if (pageGroup.PageIndex >= 2)
                            {
                                <li class=""><a href="javascript:gotoPage('@(pageGroup.PageIndex-1)')" pageGtoup="@(pageGroup.PageIndex-1)" class="page-index-comment" aria-label="前一页"><span aria-hidden="true" class="fa fa-caret-left"></span></a></li>
                            }
                            else
                            {
                                <li class="disabled"><a href="#" aria-label="前一页" class="page-index-comment"><span aria-hidden="true" class="fa fa-caret-left"></span></a></li>
                            }
                        }
                        else
                        {
                            <li class=""><a pageGtoup="1" class="page-index-comment" aria-label="第一页"><span aria-hidden="true" class="fa fa-step-backward"></span></a></li>
                            <li class=""><a pageGtoup="@(pageGroup.PagenateGroupItem.FirstIndex-1)" class="page-index-comment" aria-label="回退一组"><span aria-hidden="true" class="fa fa-backward"></span></a></li>
                            <li class=""><a pageGtoup="@(pageGroup.PageIndex-1)" class="page-index-comment" aria-label="前一页"><span aria-hidden="true" class="fa fa-caret-left"></span></a></li>
                        }
                        @for (int i = pageGroup.PagenateGroupItem.FirstIndex; i < pageGroup.PagenateGroupItem.LastIndex + 1; i++)
                        {
                            var activeString = "";
                            if (i == pageGroup.PageIndex)
                            {
                                activeString = "active";
                            }
                            <li class="@activeString "><a pageGtoup="@i" class="page-index-comment  @(pageGroup.PageIndex==i?"click_a":"")">@i <span class="sr-only">(current)</span></a></li>
                        }
                        @if (pageGroup.PagenateGroupItem.LastIndex == pageGroup.PageAmount)
                        {
                            if (pageGroup.PageIndex < pageGroup.PageAmount)
                            {
                                <li class=""><a pageGtoup="@(pageGroup.PageIndex+1)" class="page-index-comment" aria-label="下一页"><span aria-hidden="false" class="fa fa-caret-right"></span></a></li>
                            }
                            else
                            {
                                <li class="disabled"><a href="#" aria-label="下一页"><span aria-hidden="true" class="fa fa-caret-right"></span></a></li>
                            }
                            <li class="disabled"><a href="#" aria-label="向前一组"><span aria-hidden="true" class="fa fa-forward"></span></a></li>
                            <li class="disabled"><a href="#" aria-label="最后页"><span aria-hidden="true" class="fa fa-fast-forward"></span></a></li>
                        }
                        else
                        {
                            <li class=""><a pageGtoup="@(pageGroup.PageIndex+1)" class="page-index-comment" aria-label="后一页"><span aria-hidden="true" class="fa fa-caret-right"></span></a></li>
                            <li class=""><a pageGtoup="@(pageGroup.PagenateGroupItem.LastIndex+1)" class="page-index-comment" aria-label="向前一组"><span aria-hidden="true" class="fa fa-forward"></span></a></li>
                            <li class=""><a pageGtoup="@pageGroup.PageAmount" class="page-index-comment" aria-label="最后一条"><span aria-hidden="true" class="fa fa-fast-forward"></span></a></li>
                        }

                    </ul>
                </nav>
            }
        </div>
        @Html.SGoSetListPageParameter(pageParameter)
    </div>
</div>